import config from '../config';
import axios from 'axios';

class HttpManager {
    get(url, params = {}, header = {}) {
        return axios.get(`${config.BASEURL}${url}`, {
            params: params,
            headers: header
        }).then((res) => {
            console.log(4, res);
            return res.data
        }, (error)=> {
            console.log(5, error);
            return error
        }).catch((err) => {
            console.log(6, err);
            return err
        })
    }
    post(url, data = {}, configs = {}) {
        return axios.post(`${config.BASEURL}${url}`, data, configs).then((res) => {
            console.log(4, res);
            return res.data
        }, (error)=> {
            console.log(5, error);
            return error
        }).catch((err) => {
            console.log(6, err);
            return err
        })
    }

}

export default new HttpManager();
